﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DBBase;

namespace Business
{
    public partial class jianceguocheng : Form
    {
        public jianceguocheng()
        {
            InitializeComponent();
        }

        private void but_query_Click(object sender, EventArgs e)
        {
            getjilu();
        }
        public void getjilu()
        {
           
            list.Rows.Clear();
            Query mquery = new Query();
            string sql;
            sql = string.Format(@"Select * from JianCheGuoCheng where JCGC_KSSJ>'{0}' and JCGC_KSSJ<'{1}'", date_jieshu.Value.ToShortDateString() + " 00:00:00", dateTimePicker1.Value.ToShortDateString() + " 23:59:59");

            if (!(textBox2.Text == ""))
            {
                sql = sql + string.Format(@" and JCGC_JCLSH like '%%{0}%%' ", textBox2.Text);
            }
            sql = sql + " order by JCGC_ID ASC ";
            DataTable dt = mquery.GetTable(sql);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    this.list.Rows.Add();
                    this.list.Rows[i].Cells[0].Value = dt.Rows[i]["JCGC_ID"].ToString().Trim();
                    this.list.Rows[i].Cells[1].Value = string.Format("{0}", dt.Rows[i]["JCGC_XM"].ToString().Trim());
                    this.list.Rows[i].Cells[2].Value = dt.Rows[i]["JCGC_CS"].ToString().Trim();
                    this.list.Rows[i].Cells[3].Value = dt.Rows[i]["JCGC_SBBH"].ToString().Trim();
                    this.list.Rows[i].Cells[4].Value = dt.Rows[i]["JCGC_KSSJ"].ToString().Trim();
                    this.list.Rows[i].Cells[5].Value =dt.Rows[i]["JCGC_XRSJ"].ToString().Trim();
                    this.list.Rows[i].Cells[6].Value = dt.Rows[i]["JCGC_SSSJ"].ToString().Trim();
                    this.list.Rows[i].Cells[7].Value = dt.Rows[i]["JCGC_JYZT"].ToString().Trim();
                    this.list.Rows[i].Cells[8].Value = dt.Rows[i]["JCGC_JCLSH"].ToString().Trim();


                }
            }
            else
            {
                MessageBox.Show("没有记录集");
            }

        }

    }
}
